/*
 * @Author: szx
 * @Date: 2022-06-10 18:32:41
 * @LastEditTime: 2022-06-10 18:45:27
 * @Description:
 * @FilePath: \leetcode\面试题\16\20\20.js
 */
/**
 * @param {string} num
 * @param {string[]} words
 * @return {string[]}
 */
var getValidT9Words = function (num, words) {
    const res = [];
    const obj = {
        a: 2,
        b: 2,
        c: 2,
        d: 3,
        e: 3,
        f: 3,
        g: 4,
        h: 4,
        i: 4,
        j: 5,
        k: 5,
        l: 5,
        m: 6,
        n: 6,
        o: 6,
        p: 7,
        q: 7,
        r: 7,
        s: 7,
        t: 8,
        u: 8,
        v: 8,
        w: 9,
        x: 9,
        y: 9,
        z: 9
    };
    for (let word of words) {
        let tmp = '';
        for (let w of word) {
            tmp += obj[w];
        }
        if (num === tmp) res.push(word);
    }
    return res;
};
